<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePlacesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('places', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id')->unsigned();

            $table->char('uuid', 32)->unique(); //$table->uuid() = char(36) by default

            $table->string('name', 64);
            $table->string('address', 100);

            //Valid latitudes are from -85.05112878 to 85.05112878 degrees.
            $table->double('latitude', 8, 6);
            $table->double('longitude', 9, 6);

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('places');
    }
}
